﻿
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>存货档案选择</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/js/layui/css/layui.css" rel="stylesheet" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/js/framework/commonjs.js"></script>
    <script src="~/js/layui/layui.js"></script>
    <script src="~/js/sysweb/inventoryjs.js"></script>
</head>
<body>
    <div class="layui-fluid" style="margin:5px">
        <ul lay-bar="disabled" class="mWebBanner">
            <li class="layui-nav-item" style="float:left;">
                <button type="button" onclick="Confirm()" class="buttonCss">
                    <i class="layui-icon" style="margin-right:3px">&#x1005;</i>确定选择
                </button>
            </li>
     
            <li class="layui-nav-item" style="float:left;margin-left:3%">
                <button type="button" onclick="closeWin()" class="buttonCss">
                    <i class="layui-icon" style="margin-right:3px">&#x1007;</i>关闭页面
                </button>
            </li>

          
        </ul>
        <div style="float:left">
            <div id="treeNav" class="demo-tree demo-tree-box" style="width: 220px; height:500px; overflow: scroll;float:left;"></div>

        </div>
        <div style="float:left;width:75%;">
            <div class="layui-card">
             

                <div style="padding-top:5%;padding-bottom:5%">
                    <div class="layui-form-item">
                        <div class="layui-input-group" style="float:left;">
                            <div class="layui-input-prefix">
                            选择大类
                            </div>
                            <input type="text" id="proName" name="proName" class="layui-input" style="width:200%">
                            <input type="hidden" id="proCode" name="proCode" class="layui-input" >
                           
                        </div>
                       
                    </div>
                </div>
            </div>


        </div>
    </div>
</body>

</html>

<script>
    var cData = new Array();
   
    var single = "1";
    $(function () {
        single = getUrlVariable("isSingle");
        SCommonTree("ptype", "proName", "spec");
    })
    function SCommonTree(dataType, kjCode, kjName) {
        $.ajax({
            url: "../Basic/CommonDataTree",
            data: { dataType: dataType },
            dataType: "json",
            type: "POST",
            success: function (rsl) {
                if (rsl.result) {
                    
                    SloadTree(rsl.data, kjCode, kjName);
                } else {
                    layer.msg(rsl.message);
                }
            }
        });
    }
    function SloadTree(data) {
        var tree = layui.tree;
        var layer = layui.layer;
        var util = layui.util;
        //开启节点操作图标
        tree.render({
            elem: '#treeNav'
            , data: data
            , click: function (obj) {
                console.log(obj)
                $("input[ name='proCode']").val(obj.data["id"]);
                $("input[ name='proName']").val(obj.data["title"]);
      
            }
        });
    }
    /**
    确认选择
    **/
    function Confirm() {

        if ($("input[ name='proCode']").val()=="") {
            layer.msg("您没有选择任何数据"); return;
        } else {
            if (single == "1" && cData.length > 1) {
                layer.msg("请选择一条数据"); return;
            } else {
                var obj = new Object();
                obj = {
                    "proCode": $("input[ name='proCode']").val(),
                    "proName": $("input[ name='proName']").val()
                }
                parent.getChildPar(obj); //这是父页面函数
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
        }
    }
</script>

